package com.jchen.auth.handler;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Description 动态代理类
 * @Author jchen
 * @Date 2024/2/23 9:23
 */
public class MyInvocationHandler implements InvocationHandler {

    private Object target;

    public MyInvocationHandler(Object target) {
        this.target = target;
    }
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("Before method call.");
        Object result = method.invoke(target, args);
        System.out.println("After method call.");
        return result;
    }
}
